package com.me.components.map {
	import com.me.components.MapResource;

	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.utils.Dictionary;

	import spark.core.SpriteVisualElement;

	/**
	 *
	 * @author yw
	 *
	 * @Date 2011-9-16 下午04:32:05
	 */
	public class BuildingLayer extends SpriteVisualElement {
		private var _dic:Dictionary = new Dictionary();

		public function BuildingLayer(w:int, h:int) {
			super();
			width = w;
			height = h;
		}

		override public function addChild(child:DisplayObject):DisplayObject {
			var key:String = (child as MapResource).attatchment.img;
			_dic[key] = child;
			return super.addChild(child);
		}

		public function containsRes(key:String):MapResource {
			return _dic[key];
		}

		public function clear():void {
			while (numChildren > 0) {
				removeChildAt(0);
			}
		}
	}
}